import Vue from 'vue'
import element from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import '#/css/icon/iconfont.css'
// import axios from 'axios'

import App from './App'
import router from './router'
import filter from './common/filter.js'
import store from './store'
import C from '@/common/common.js'
// import '@/common/KeyUp.js'

import Win from 'electron-vue-windows'
Win.init({
  freeWindowNum: 2
})
Vue.prototype.$Win = Win
Vue.use(element)

// if (!process.env.IS_WEB) Vue.use(require('vue-electron'))
// Vue.http = Vue.prototype.$http = axios
// Vue.config.productionTip = false

// 注册全局过滤器
Object.keys(filter).forEach(key => {
  Vue.filter(key, filter[key])
})

Vue.directive('qx', {
  bind: function (el, binding) {
    let val = binding.value
    let sto = []
    let permission = C.getLocalStorage('permission')
    if (permission !== 'undefined') {
      sto = JSON.parse(permission)
    }
    let empty = false
    sto.forEach((v) => {
      if (v === val) {
        empty = true
      }
    })
    if (!empty) {
      el.parentNode.removeChild(el)
    }
  }
})

/* eslint-disable no-new */
new Vue({
  router,
  store,
  template: '<App/>',
  components: { App }
}).$mount('#app')
